/*
 * @Author: gk 
 *  报表管理
 * @Date: 2018-03-15 14:44:57 
 * @Last Modified by: csy
 * @Last Modified time: 2019-05-27 16:52:42
 */
layui.config({
}).use(['element', 'zltreemenu', 'tree','zlpoptree', 'treeGrid', 'zlSelectEx', 'zlDynamicCondition', 'zlPopSourceForm', 'zlPinYin', 'upload', 'dropdown', 'zlPrint'], function (exports) {
    var $ = layui.$
        , zlContext = layui.zlContext
        , zltreemenu = layui.zltreemenu
        , layer = layui.layer
        , form = layui.form
        , upload = layui.upload
        , treeGrid = layui.treeGrid
        , zlPinYin = layui.zlPinYin
        , zlConfig = layui.zlConfig
        , zlPopSourceForm = layui.zlPopSourceForm
        , statusName = zlConfig.global.result.statusName
        , msgName = zlConfig.global.result.msgName
        , dataName = zlConfig.global.result.dataName
        , OK = zlConfig.global.result.okState
        , fullheight = 'full'
        , loadingLayer
        , intervalId = undefined
        // , fullheight = 'full-80'
        , CATLOG = 'reports'
        , REPORT_EXT = 'rpx|sht|cpt|xls|xlsx'
        , REPORT_MIME = 'report/rpt,report/sht,report/cpt';

    var fromlayerIndex,
        isloadsearch = false,
        orgtreeObj = zltreemenu.render('orgtree', {
            dataurl: layui.cache['contentPath'] + "/manager/corefunction/queryorgddata?resId=7FEF1A6CF1EA4EC498D7E40375D4806C",
            type: "get",
            tableId: 'tbReport',
            isMove: false
        }, {
            onAsyncSuccess: function (event, treeId, treeNode, msg) {
                orgtreeObj.selectNode(orgtreeObj.getNodes()[0]);
                $('#' + orgtreeObj.getNodes()[0].tId + '_a').click()
            },
            onClick: function (event, treeId, treeNode) {
                gridAction.refresh(null);
            }
        }),
        pingps = {
            '5758F06288714A51BDC1F1E17E3FEC4C': '润乾'
            , '385D6FF9B8344D2D86F17BF98218B74A': '帆软'
            , 'AFA32A3F2BE84226B81A2DAE6EB702F7': '快搭'
        },
        reptypes = {
            '75AF609D5C6A43CEBA584532470D3033': '普通报表'
            , 'D910CAB4442F4E9AB0B3D63D7980CF6A': '填报报表'
        },
        iconsetting = "{shiycjid:'8AFD93EB34B24C0DBC8A39353B350CBA',isOpenAdQ:true,type:'image'," +
            'coltitle:[[' +
            '{ type: "numbers", fixed: "left", title: "#" },' +
            '{ type: "radio", fixed: "left" },' +
            '{ field: "WJZY_MINGC", title: "名称", width: 100,sort: true },' +
            '{ field: "WJZY_BIANH", title: "编号", width: 150,sort: true },' +
            '{ field: "WJZY_ZIYLJ", title:"资源", width: 150,templet: "<div><img atl=' + "''" + "src='" + layui.cache['contentPath'] + "{{ d.WJZY_ZIYLJ}}" + "'" + '></div>"}]],' +
            "limit:10,formtitle:'选择图标',page:true, id:'WJZY_ZIYLJ',name : 'WJZY_ZIYLJ', method:'post',params:'{WJZY_LEIX:0}' ,dataurl:'" + layui.cache['contentPath'] + "/manager/corefilesres/query'}";

    //渲染报表列表
    var reportTable = treeGrid.render({
        elem: '#tbReport'
        , height: fullheight
        , response: zlConfig.global.gridResponse
        , limit: 10000
        , treeId: 'RWID'//树形id字段名称
		, treeUpId: 'SYS_PARENTID'//树形父id字段名称
        , treeShowName: 'REP_MINGC'//以树形式显示的字
        , chkboxType: { "Y": "","N": ""}
        , isOpenDefault: false
        , cols: [[ //表头
            { type: 'checkbox' }
            , { field: 'REP_MINGC', width: '175', title: '名称', sort: true }
            , { field: 'REP_BIANH', width: '100', title: '编号', sort: true }
            , {
                field: 'REP_PINP', width: '90', title: '品牌', templet: function (d) {
                    return '<span>' + pingps[d.REP_PINP] + '</span>'
                }
            }
            , {
                field: 'REP_LEIX', width: '80', title: '类型', templet: function (d) {
                    return '<span>' + reptypes[d.REP_LEIX] + '</span>'
                }
            }
            , {
                field: 'REP_TUB', width: '60', title: '图标', templet: function (d) {
                    return d.REP_TUB ? '<img atl="" src="' + layui.cache['contentPath'] + d.REP_TUB + '">' : '';
                }
            }
            , { field: 'REP_LUJ', width: '275', title: '报表链接' }
            , { field: 'OPTION', width: 250, title: '操作', align: 'center', toolbar: '#barReport' }
        ]]
        , event:
        {
            onRowdbClick: function (field, row) {
                gridAction.viewRow(row);
            }
        }
        , page: false
    });
    var treeTable = {
        getSelectedNodes: function () {
            var checkStatus = treeGrid.checkStatus('tbReport');
            return checkStatus.data;
        }
    }

    var gridAction = {
        currentEditObj: undefined,
        
        gridEdit: function (parentrow, row, type, readonly) {
            var readonly = readonly && readonly != 0 ? 'disabled' : '';
            var orgid = orgtreeObj.getSelectedNodes().length > 0 ? orgtreeObj.getSelectedNodes()[0].RWID : '9C876276D8884BFF94DF343E2A4EED7D';
            var psettings = "{name:'REP_MINGC',dataurl:'"+layui.cache['contentPath'] + "/manager/corereport/query?ORGID=" + orgid + "',method:'post',formtitle:'选择上级报表',edittype:'edit'}";
            var frm = [
                '<div class="site-block" lay-filter="divgridField"> <form id ="frmEditGrid" class="layui-form"  action="">'
                , '	<div class="layui-form-item layui-hide">'
                , '		<div class="layui-input-block">'
                , '			<input type="text" name="EDITTYPE" class="layui-input">'
                , '			<input type="text" name="RWID" class="layui-input">'
                , '			<input type="text" name="ORGID" class="layui-input">'
                , '		</div>'
                , '	</div>'
                , '	<div class="layui-form-item">'
                , '		<label class="layui-form-label">名称</label>'
                , '		<div class="layui-input-block">'
                , '			<input type="text" maxlength="85" name="REP_MINGC" ' + readonly + ' lay-verify="required" placeholder="请输入名称" class="layui-input">'
                , '		</div>'
                , '	</div>'
                , '	<div class="layui-form-item">'
                , '		<label class="layui-form-label">编号</label>'
                , '		<div class="layui-input-block">'
                , '			<input type="text" maxlength="33" name="REP_BIANH" ' + readonly + ' lay-verify="required" placeholder="请输入编号" class="layui-input">'
                , '		</div>'
                , '	</div>'
                , '	<div class="layui-form-item">'
                , '		<label class="layui-form-label">报表品牌</label>'
                , '		<div class="layui-input-block">'
                , '	  		<select name="REP_PINP" lay-verify="required" ' + readonly + ' placeholder="请选择品牌"  zlcomponent class="select-ext" settings="{titlefield: \'VALUE\', valuefield: \'DCMX_KEY\',dataurl:\'' + layui.cache['contentPath'] + '/manager/coredictionary/querydictionarybyid?RWID=EBB0373768D8465E8B946F5099028CA9\'}">'
                , '	  		</select>'
                , '		</div>'
                , '	</div>'
                , '	<div class="layui-form-item">'
                , '		<label class="layui-form-label">类型</label>'
                , '		<div class="layui-input-block">'
                , '	  		<select name="REP_LEIX" lay-verify="required" ' + readonly + ' placeholder="请选择类型"  zlcomponent class="select-ext" settings="{titlefield: \'VALUE\', valuefield: \'DCMX_KEY\',dataurl:\'' + layui.cache['contentPath'] + '/manager/coredictionary/querydictionarybyid?RWID=E86C8DB4D90245EE85748FF84756877D\'}">'
                , '	  		</select>'
                , '		</div>'
                , '	</div>'
                , ' <div class="layui-form-item">'
                , '       <div class="layui-col-md12">'
                , '           <label class="layui-form-label">图标</label>'
                , '           <div class="layui-input-block" id="smalldiv">'
                , '               <div name="REP_TUB" ' + readonly + ' zlcomponent class="layui-form-select zlPopSourceForm">'
                , '               </div>'
                , '           </div>'
                , '       </div>'
                , '   </div>'
                , '<div class="layui-form-item">'
                , '    <div class="layui-col-md12">'
                , '        <label name="pfunction" class="layui-form-label">上级报表</label>'
                , '        <div class="layui-input-block">'
                , '            <div name="SYS_PARENTID" zlcomponent class="layui-form-select zlpoptree" value="">'
                , '            </div>'
                , '         </div>'
                , '     </div>'
                , ' </div>'
                , '	<div class="layui-form-item">'
                , '		<label class="layui-form-label">报表链接</label>'
                , '		<div class="layui-input-block">'
                , '				<textarea maxlength="333" placeholder=""  disabled  name="REP_LUJ" class="layui-textarea"></textarea>'
                , '		</div>'
                , '	</div>'
                , '	<div class="layui-form-item' + (readonly == 'disabled' ? ' layui-hide"' : '"') + '>'
                , '		<div class="layui-input-block">'
                , '		  <button class="layui-btn" lay-submit lay-filter="frmEditGrid">保存</button>'
                // , '		  <button type="reset" class="layui-btn layui-btn-primary ' + (type == 'edit' ? 'layui-hide"' : '"') + readonly + '>重置</button>'
                , '		</div>'
                , '	</div>'
                , '</form></div>'
            ];
            layer.open({
                type: 1,
                title: readonly == 'disabled' ? '查看' : (type == 'edit' ? '编辑' : '新增'),
                id: 'coreReportLayer',
                area: ['100%', '100%'],
                content: frm.join(''),
                success: function (layero, index) {
                    $('div[name="SYS_PARENTID"]').attr("settings", psettings);
                    var object = eval('(' + iconsetting + ')')
                    if (readonly == 'disabled') {
                        object.edittype = 'readonly';
                    } else {
                        object.edittype = 'edit';
                    }
                    iconsetting = JSON.stringify(object);
                    $('div[name="REP_TUB"]').attr('settings', iconsetting);
                    if (type == 'edit') {
                        $('div[name="REP_TUB"]').attr('value', row.REP_TUB);
                        $('div[name="REP_TUB"]').attr('text', row.REP_TUB == '' ? '' : layui.cache['contentPath'] + row.REP_TUB);
                        if (readonly == 'disabled') {
                            $('div[name="REP_TUB"]').addClass('layui-disabled');
                            $("#REP_TUBaddspan").addClass('layui-disabled');
                            $("#REP_TUBdelspan").addClass('layui-disabled');
                        }
                        $('div[name="SYS_PARENTID"]').attr("value", row.SYS_PARENTID);
                        // $('div[name="SYS_PARENTID"]').attr("text", rows[0].SYS_PARENTID);
                        zlContext.autoFill($('#frmEditGrid'), row);
                        $('#frmEditGrid input[name=EDITTYPE]').val('edit');
                        form.render();
                    }
                    else {
                        /**设置隐藏属性*/
                        $('#frmEditGrid input[name=EDITTYPE]').val('new');
                        
                        $('#frmEditGrid input[name=ORGID]').val(orgid);

                        if (parentrow) {
                            $('div[name="SYS_PARENTID"]').attr("value", parentrow['RWID']);
                        }
                        //由于layui是主动刷新需要重新刷新才能显示出状态
                        form.render();

                        if (zlContext.browserType() == 'IE') {
                            zlPopSourceForm.render($('div[name=REP_TUB]'));
                        }

                        $('#frmEditGrid input[name=REP_MINGC]').change(function () {
                            var v = $('#frmEditGrid input[name=REP_MINGC]').val();
                            /**设置报表名 */
                            var v1 = zlPinYin.C(v);
                            $('#frmEditGrid input[name=REP_BIANH]').val(v1);
                            form.render();
                        });
                    }
                    fromlayerIndex = index;
                },
                cancel: function (index, layero) {
                    if (type == 'edit' && readonly != 'disabled') {
                        zlContext.isFormDataChange('frmEditGrid', gridAction.currentEditObj.data, gridAction, index)
                        return false;
                    }
                }
            });
        },
        viewRow: function (row) {
            gridAction.gridEdit(null, row, 'edit', true);
        },
        newRow: function () {
            var nodes = treeTable.getSelectedNodes();
            if(nodes.length>1){
                zlContext.warnMsg('不能同时选择两个节点进行新增！')
                return;
            }
            gridAction.gridEdit(nodes.length > 0 ? nodes[0] : null, null, 'new');
        },
        editRow: function (row) {
            gridAction.gridEdit(null, row, 'edit');
        },
        deleteRows: function (rows) {
            if (rows.length == 0) {
                zlContext.warnMsg('请选择需要删除的报表');
                return;
            }
            var ids = [];
            for (var i = 0; i < rows.length; i++) {
                if (rows[i].children.length > 0) {
                    zlContext.warnMsg(rows[i].REP_MINGC + "节点下还有子模板，请先删除子模板");
                    canpost = false;
                    return;
                }
                ids.push(rows[i].RWID);
            }
            zlContext.confirm('询问', '是否要删除选择的报表?', function (index) {
                var param = { ids: ids.join(",") };
                //提交删除
                zlContext.deletePost(layui.cache['contentPath'] + '/manager/corereport/remove', param, function (result) {
                    if (result[statusName] == OK) {
                        gridAction.refreshGrid('del')
                        zlContext.successMsg('删除成功');
                    }
                    else {
                        zlContext.errorMsg(result[msgName]);
                    }
                });
                layer.close(index);
            });
        },
        exportFile: function (row) {
            if ($("#ifexport").length == 0) {
                $("body").append('<iframe id="ifexport" style="display:none"></iframe>');
            }
            loadingLayer = layer.msg('下载中，请稍候...', { icon: 16, time: false, shade: 0.1 });
            var _downloadid = new Date().getTime();
            $("#ifexport").attr("src", layui.cache['contentPath'] + '/manager/corereport/download?id=' + row['RWID'] + '&_downloadid=' + _downloadid);
            var iframe = document.getElementById('ifexport');
            iframe.onload = iframe.onreadystatechange = function iframeload() {
                if (intervalId) {
                    clearInterval(intervalId);
                }
                layer.close(loadingLayer);
                if (!iframe.readyState || iframe.readyState == "complete") {
                    var iframeText = document.getElementById('ifexport').contentWindow.document;
                    iframeText = $(iframeText).text();
                    if (iframeText) {
                        var obj = JSON.parse(iframeText);
                        zlContext.errorMsg(obj.msg);
                    }

                }
            };
            intervalId = setInterval(function () {
                var cookieName = '_downloadid' + _downloadid;
                var cookieValue = zlContext.getCookieValue(cookieName);
                if (cookieValue && cookieValue == _downloadid) {
                    layer.close(loadingLayer);
                    if (intervalId) {
                        clearInterval(intervalId);
                        intervalId = undefined;
                    }
                }
            }, 500);
        },
        sumbit: function (fields) {
            var editType = $('#frmEditGrid input[name=EDITTYPE]').val();
            if (editType == 'new') {
                zlContext.put(layui.cache['contentPath'] + '/manager/corereport/add', fields, function (result) {
                    if (result[statusName] == OK) {
                        gridAction.refreshGrid(editType, result[dataName]);
                        layer.close(fromlayerIndex);
                        zlContext.successMsg('保存成功');
                        return true;
                    }
                    else {
                        zlContext.errorMsg(result[msgName]);
                    }
                });
            } if (editType == 'edit') {
                if (fields.RWID == fields.SYS_PARENTID) {
                    zlContext.errorMsg('上级报表不能为自身');
                    return false;
                }
                zlContext.post(layui.cache['contentPath'] + '/manager/corereport/modify', fields, function (result) {
                    if (result[statusName] == OK) {
                        gridAction.refreshGrid(editType, fields);
                        layer.close(fromlayerIndex);
                        zlContext.successMsg('保存成功');
                        return true;
                    } else {
                        zlContext.errorMsg(result[msgName]);
                    }
                });
            }
            return false;
        },
        search: function () {
            var param = {};
            if ($('#edtSeacherValue').val().length > 0) {
                param['REP_MINGC'] = $('#edtSeacherValue').val();
                isloadsearch = true;
            }
            layui.event('WM_USERDEF',
                zlConfig.global.WM_USERDEF.REFRESHDATA_DATA, param);
        },
        refresh: function (node) {
            $('#edtSeacherValue').val("")
            var param = {};
            if ($('#edtSeacherValue').val().length > 0) {
                param['REP_MINGC'] = $('#edtSeacherValue').val();
            }
            layui.event('WM_USERDEF', zlConfig.global.WM_USERDEF.REFRESHDATA_DATA, param);
        },
        refreshGrid: function (type, row) {
            /**刷新行 */
            if (type == 'edit' && gridAction.currentEditObj) {
                gridAction.currentEditObj.update(row);
                gridAction.refresh(null);
            } else {
                gridAction.refresh(null);
            }
        },
        getParams: function () {
            var param = {};
            param['REP_MINGC'] = $('#edtSeacherValue').val();
            var chkRows = treeTable.getSelectedNodes(),
                chkrwids = [];
            $.each(chkRows, function (index, row) {
                chkrwids.push(row.RWID);
            });
            param['chkrwids'] = chkrwids.join(',');
            return param;
        },
        copy: function (rows) {
			if (rows.length == 0) {
				zlContext.warnMsg('请选择需要复制的报表');
				return;
			}
			var html = [
				'<div class="layui-form " style="height:100%">'
				, '	<div class="layui-form treecopybox" style="height:calc(100% - 94px);overflow:auto;">'
				, '		<ul id="treeCopyOrg" class="ztree" style="float:left"></ul>'
				, '	</div>'
                , '	<div class="treecopybtn"  style="height:54px;overflow:auto;padding-right: 10px;">'
				, '		  <button id="btnCopyCancel" class="layui-btn layui-btn-primary fr" style="color:#555;background-color:#fff">取消</button>'
				, '		  <button class="layui-btn fr mr10" lay-submit lay-filter="btnCopyOk">确定</button>'		  
				, '	</div>'
				, '</div>'];
			var frmobj = layer.open({
				type: 1,
				limit: 999,
				id: 'copyToOrgLayer',
				area: ['500px', '500px'],
				title: '选择要复制到的机构',
				content: html.join(''),
				success: function (layero, index) {
					setMaxCopyHeight(layero);
					zltreemenu.render('treeCopyOrg',{
						dataurl: layui.cache['contentPath'] + '/manager/corefunction/queryorgddata',
						type: 'get',
						search: true,
						isMove: false,
						checkEnable:true,
						chkboxType:{ "Y": "", "N": "" }
					},{})
					// treeAction.loadTree('treeCopyOrg', undefined, undefined, { enable: true, chkboxType: { "Y": "", "N": "" } });
					form.on('submit(btnCopyOk)', function (frm) {
						var treeCopyObj = $.fn.zTree.getZTreeObj("treeCopyOrg");
						var nodes = treeCopyObj.getCheckedNodes(true);
                        var descOrgids = [], srcFwids = [];
                        var sourceOrgid = orgtreeObj.getSelectedNodes()[0].RWID;
						if(nodes.length==0){
							zlContext.warnMsg('请选择要复制到的机构！');
							return;
                        }                      
                        nodes.forEach(function (v) { descOrgids.push(v['RWID']); });                        
						rows.forEach(function (v) { srcFwids.push(v['RWID']);});
						zlContext.post(
							layui.cache['contentPath'] + '/manager/corereport/copyto',
							{ srcids: srcFwids, desorgid: descOrgids,sourceorgid: sourceOrgid},
							function (result) {
								if (result[statusName] == OK) {
									zlContext.successMsg('报表复制完毕');
									layer.close(frmobj);
								}
								else {
									zlContext.errorMsg(result[msgName]);
								}
							});
						return false;
					});
					//点击取消关闭弹出层
					$("#btnCopyCancel").on("click",function(){
						layer.close(index);
					})
				},
				resizing:function(layero){
					setMaxCopyHeight(layero);
                },
			});
		},
    }
    $('#btnReportRefresh').on('click', function () {
        gridAction.refresh(null);
    });
    $('#btnReportNew').on('click', function () {
        gridAction.newRow();
    });
    $('#btnCopy').on('click', function () {
        var sourceOrgid = orgtreeObj.getSelectedNodes()[0].RWID;
        if(sourceOrgid !='9C876276D8884BFF94DF343E2A4EED7D'){
            zlContext.warnMsg('只能从通用机构复制到个性机构');
            return;
        }
        var rows = treeTable.getSelectedNodes();
        gridAction.copy(rows);
    });
    $('#btnReportDelete').on('click', function () {
        var rows = treeTable.getSelectedNodes();
        gridAction.deleteRows(rows);
    });
    $('#btnSeacher').on('click', function () {
        gridAction.search();
    });
    $('#edtSeacherValue').on('keyup', function (event) {
        var keyCode = event.keyCode;
        if (keyCode == 13) {
            gridAction.search();
        }
        if ((keyCode == '46' || keyCode == '8' || (event.ctrlKey && keyCode == '86')) && $(this).val() == '' && isloadsearch) {
            $('#btnSeacher').trigger('click');
            isloadsearch = false;
        }
    });
    $('#btnopenall').on('click', function () {
        var treedata = treeGrid.getDataTreeList('tbReport');
        if ($(this).find('i').hasClass("layui-icon-down")) {
            $(this).find('i').removeClass("layui-icon-down").addClass("layui-icon-up");
            $(this).find('span').text("收起全部")
        } else {
            $(this).find('i').removeClass("layui-icon-up").addClass("layui-icon-down");
            $(this).find('span').text("展开全部")
        }
        treeGrid.treeOpenAll('tbReport', !treedata[0][treeGrid.config.cols.isOpen]);
    });
    treeGrid.on('tool(tbReport)', function (obj) {
        var row = obj.data; //获得当前行数据
        var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
        // var tr = obj.tr; //获得当前行 tr 的DOM对象
        if (layEvent === 'detail') { //查看
            gridAction.viewRow(row)
        } else if (layEvent === 'del') { //删除
            gridAction.currentEditObj = obj;
            gridAction.deleteRows([row]);
        } else if (layEvent === 'edit') { //编辑
            gridAction.currentEditObj = obj;
            gridAction.editRow(row);
        } else if (layEvent == 'export') {
            gridAction.exportFile(row);
        } else if (layEvent == 'import') {
            gridAction.currentEditObj = obj;
        }
    });
    //提交
    form.on('submit(frmEditGrid)', function (frm) {
        if ($(frm.elem).hasClass('getField')) {
            gridAction.newFields = frm.field
            return false;
        }
        return gridAction.sumbit(frm.field);
    });
    //监听刷新的事件
    layui.event('WM_USERDEF', zlConfig.global.WM_USERDEF.REFRESHDATA_DATA, null, function (param) {
        var index = layer.msg('数据查询中，请稍候...', { icon: 16, time: false, shade: 0.1 });
        var loadGridData = function (tableId, url, param) {
            reportTable.reload({
                url: url
                , height: fullheight
                , page: false
                , limit: 10000
                , method: 'post'
                , where: param
                , done: function (res, curr, count) {
                    layer.close(index);
                    var currentId = '';
                    upload.render({
                        elem: '.reportImport'
                        , url: layui.cache['contentPath'] + '/manager/corereport/upload/'
                        , data: {
                            catlog: function () {
                                // return gridAction.currentEditObj ? gridAction.currentEditObj.data['RWID'] : null;
                                return currentId;
                            }, id: function () {
                                // return gridAction.currentEditObj ? gridAction.currentEditObj.data['RWID'] : null;
                                return currentId;
                            }
                        }
                        , accept: 'file'
                        , acceptMime: REPORT_MIME
                        , exts: REPORT_EXT
                        , choose: function (obj) {
                            currentId = $(this.item).attr('data-id')
                        }
                        , before: function () {
                            winIndex = layer.msg('导入中，请稍候...', { icon: 16, time: false, shade: 0.1 });
                        }
                        , done: function (res, index, upload) {
                            layer.close(winIndex);
                            if (res[statusName] != OK) {
                                return layer.msg('导入失败' + res[msgName]);
                            }
                            else {
                                // gridAction.currentEditObj.update(res[dataName]);
                                treeGrid.reload('tbReport');
                                // gridAction.refresh(null);
                            }
                            zlContext.successMsg('导入完毕');
                        }
                    })
                }
            });
        }
        var orgid = orgtreeObj.getSelectedNodes().length > 0 ? orgtreeObj.getSelectedNodes()[0].RWID : '9C876276D8884BFF94DF343E2A4EED7D'; 
        param.ORGID = orgid;
        //刷新
        loadGridData('tbReport', layui.cache['contentPath'] + '/manager/corereport/query', param);
    });

    // //注册打印获取参数回调函数
    // zlPrint.regeditparamCallBack("aaaaaa", gridAction.getParams);
    // zlPrint.regeditparamCallBack("bbbb", gridAction.getParams);

    // gridAction.refresh(null);
    function setMaxCopyHeight(index){
    }

    $(window).on('resize', function () {
        zlContext.setMaxHeihgt(0);
    }).resize();

});